package com.larry.isn;

/**
 * Startup to test isn search
 */
import java.util.List;

import com.larry.cleaner.DataCleaner;
import com.pegatron.ers.server.app.helper.ContextHelper;
import com.pegatron.ers.server.app.service.common.IProductService;
import com.pegatron.ers.vo.product.ProductConfig;

public class IsnTester {

	private Recorder recorder;

	private Integer concurents = 5;

	private Integer perDayUnits = 20000;

	private DataSearcher dataSearcher;

	private IProductService pService;

	public static void main(String[] args) throws Exception {
		IsnTester tester = new IsnTester();
		tester.runIsnSearch();
	}

	private void runIsnSearch() throws Exception {
		this.init();
		DataCleaner cleaner = new DataCleaner();
		cleaner.clean();
		List<String> list = dataSearcher.getDatas();
		
//		List<String> list = dataSearcher.getDatas2();
		
//		List<String> list = new ArrayList<String>();
//		list.add("A111200066754");
		
		ProductConfig config = new ProductConfig();
		WebServiceSearcher webService = new WebServiceSearcher(perDayUnits, recorder, list, pService, config);
		webService.start();
	}

	private void init() throws Exception {
		dataSearcher = new DataSearcher();
		pService = ContextHelper.getProductService();
		recorder = new Recorder(concurents);
	}
}
